package br.com.honorato.util.dao;

import java.io.Serializable;

import javax.persistence.criteria.Predicate;

import br.com.honorato.dao.JpaDAO;

@SuppressWarnings("rawtypes")
public class CompareFilter implements Serializable
{
	private static final long serialVersionUID = 1L;

	@SuppressWarnings("unchecked")
	public static void setFilter(ETypeCompare typeCompare, String name, String value, JpaDAO objClass)
	{
		if (ETypeCompare.EQUAL.equals(typeCompare))
		{
			Predicate equalPredicate = objClass.getCriteriaBuilder().equal(objClass.getFromRoot().get(name), value);
			objClass.getPredicates().add(equalPredicate);
		}

		// new EJBException("sdsd");
	}
}